/**
 * 
 */
package ar.com.gtug.model;

import java.util.Date;
import java.util.List;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;
import javax.jdo.annotations.Sequence;
import javax.jdo.annotations.SequenceStrategy;

import com.google.appengine.api.datastore.Key;
import com.google.appengine.api.datastore.KeyFactory;
import com.google.appengine.api.datastore.Text;

/**
 * @author Juan M. Irungaray (juan@irungaray.com.ar)
 *
 */
@PersistenceCapable(detachable="true")
@Sequence(name="events",strategy=SequenceStrategy.CONTIGUOUS)
public class Event {


	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	private Key key;
	
	@Persistent
	private String name;
	
	@Persistent
	private Date startDate;
	
	@Persistent
	private Date endDate;
	
	@Persistent
	private List<Long> topics;
	
	@Persistent
	private int timezone;
	
	@Persistent
	private String address;
	
	@Persistent
	private Location location;
	
	@Persistent
	private String url;
	
	@Persistent
	private Text description;

	/**
	 * @param name
	 * @param startDate
	 * @param endDate
	 * @param topics
	 * @param timezone
	 * @param address
	 * @param location
	 * @param url
	 * @param description
	 */
	public Event(String name, Date startDate, Date endDate, List<Long> topics,
			int timezone, String address, Location location, String url,
			Text description) {
		super();
		this.name = name;
		this.startDate = startDate;
		this.endDate = endDate;
		this.topics = topics;
		this.timezone = timezone;
		this.address = address;
		this.location = location;
		this.url = url;
		this.description = description;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Date getStartDate() {
		return startDate;
	}

	public void setStartDate(Date startDate) {
		this.startDate = startDate;
	}

	public Date getEndDate() {
		return endDate;
	}

	public void setEndDate(Date endDate) {
		this.endDate = endDate;
	}

	public List<Long> getTopics() {
		return topics;
	}

	public void setTopics(List<Long> topics) {
		this.topics = topics;
	}

	public int getTimezone() {
		return timezone;
	}

	public void setTimezone(int timezone) {
		this.timezone = timezone;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public Location getLocation() {
		return location;
	}

	public void setLocation(Location location) {
		this.location = location;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public Text getDescription() {
		return description;
	}

	public void setDescription(Text description) {
		this.description = description;
	}
	
	public String getId() {
		return KeyFactory.keyToString(key);
	}

	
	
}
